﻿using Castle.Core.Interceptor;
using Castle.DynamicProxy;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace RelationalDataInstance.ClientTest
{
    [TestClass]
    public class MainTest
    {
        [TestMethod]
        public void Test()
        {
            var proxy = new ProxyGenerator().CreateInterfaceProxyWithoutTarget<IA>(new IInterceptor[] {new Qwe()});
            Assert.AreEqual("qwe", proxy.Method1(123));
        }
    }

    public interface IA
    {
        string Method1(int arg);
    }

    public class Qwe : IInterceptor
    {
        public void Intercept(IInvocation invocation)
        {
            invocation.ReturnValue = "qwe";
        }
    }
}